#pragma once 

#include "Widget.h"
#include "Types.h"

namespace My {

#pragma warning(push)
// Disable warning about inheritance via dominance
#pragma warning(disable:4250)

class DoublyLabelledWidget : public virtual Widget, public virtual Container
{
public:
	enum Side { LeftSide, RightSide };
public:
	DoublyLabelledWidget();
public:
	Widget * GetWidget() const
		{ return m_pWidget; }
	const String & GetText(int side) const
		{ return m_Text[side]; }
	bool HasLabel(int side) const
		{ return !m_Text[side].empty(); }
	bool HasAnyLabel() const
		{ return HasLabel(LeftSide) || HasLabel(RightSide); }
	int GetAlignment() const
		{ return m_Alignment; }
public:
	void SetWidget(Widget * pWidget);
	void SetText(int side, const String & s);
	void SwapTexts();
	void SetAlignment(int a);
public:
	// handlers
	virtual void LayoutControls();
	virtual CSize GetPreferredSize() const;
	virtual void HandlePaint(CDC * pDC, const CRect & r);
	virtual void HandleFont();
	virtual void HandleUpdateUI();
private:
	void GetSizes(CDC & dc, CSize & sWidget, CSize & sAll, CSize sText[2]) const;
private:
	Widget *	m_pWidget;
	String		m_Text[2];
	int			m_Alignment;
	CRect		m_TextRect[2];
};

#pragma warning(pop)

} // My
